#ifndef basewindow_H
#define basewindow_H

#include <QWidget>
#include <QDialog>
#include<QPaintEvent>
#include<QPainterPath>
#include<qmath.h>
#include<QPainter>
#include<QStyleOption>

struct pressWindowsState
{
    bool    MousePressed;
    QPoint  MousePos;
    QPoint  WindowPos;
};

//主窗口基类-绘制窗口阴影边框QWidget
class basewindow : public QWidget
{
    Q_OBJECT
public:
    explicit basewindow(QWidget *parent = 0);
    ~basewindow();
    QWidget *m_mainwid;
    int m_border;
    QColor m_bgcolor;

public:
    void setBgcolor(QColor bgcolor);
    void initBackGroundColor();

protected:
   virtual void paintEvent(QPaintEvent *);

private:

signals:

public slots:
};

//对话框基类-绘制窗口阴影边框QDialog
class basedialog : public QDialog
{
    Q_OBJECT
public:
    explicit basedialog(QWidget *parent = 0);
    ~basedialog();
    QWidget *m_mainwid;
    QWidget *m_topwid;
    QWidget *m_contentwid;

    pressWindowsState m_state;
    int m_border;
    QColor m_bgcolor;

public:
    void initBackGroundColor();
    void initControl();
    void setLayoutWidget();
    void setBgcolor(QColor bgcolor);

protected:
   virtual void paintEvent(QPaintEvent *);
    //移动窗口(与主窗口的nativeEvent函数冲突)
    virtual void mouseMoveEvent(QMouseEvent *event);
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);

private:

signals:

public slots:
};

#endif // basewindow_H
